import 'package:flutter/cupertino.dart';
import 'package:hive_storage/data/local_storage/hive_storage_service.dart';
import 'package:hive_storage/data/settings_repository.dart';
import 'package:hive_storage/presentation/settings/settings_viewmodel.dart';

import 'app.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // 初始化存储服务
  final storage = HiveStorageService();
  await storage.init(); // 初始化 Hive
  // 创建存储库
  final repository = SettingsRepository(storage);
  // 获取初始设置
  final initialSettings = await repository.getSettings();

  runApp(MyApp(
    viewmodel:SettingsViewmodel(repository,initialSettings)));

}

